package com.lcj.hub.web.controller;

import com.lcj.hub.common.aspect.RepeatSubmit;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/")
@Slf4j
public class WelcomeController {

    @GetMapping("/welcome")
    @ResponseBody
    public Map<String, String> welcome() {
        var map = new HashMap<String, String>();
        map.put("message", "Hello, World!");
        return map;
    }

    @GetMapping("/welcome-to/{city}")
    @ResponseBody
    public String welcomeTo(@PathVariable String city) {
        return "Welcome to " + city + "!";
    }

    @GetMapping("/list")
    @ResponseBody
    public List<String> list() {
        return List.of("a", "b", "c");
    }

    @GetMapping("/int")
    @ResponseBody
    public Integer integer() {
        return 100;
    }

    @GetMapping("/string")
    @ResponseBody
    @RepeatSubmit(expireTime = 10)
    public String str() {
        return "success";
    }



}
